package com.zhx.freedom.say.diary;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 描述: 日记api模块
 * @author 周浩西
 * @date 2019/4/1 11:25
 */
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrix
@SpringBootApplication
public class FreeDomSayDiaryWebApplication {

    public static final Logger logger = LoggerFactory.getLogger(FreeDomSayDiaryWebApplication.class);
    public static void main(String[] args) {
        long startTime = System.currentTimeMillis();
        SpringApplication.run(FreeDomSayDiaryWebApplication.class, args);
        logger.info("··········自由说-日记api模块启动完成·············");
        long endTime = System.currentTimeMillis();
        logger.info("··········服务启动耗时{}毫秒·············", (endTime - startTime));
    }

    /**
     * 使用负载均衡机制
     */
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

}
